/**
 * Created by meiguizhinian on 2018/7/26
 * Copyright © 2018 lixiaolong. All rights reserved.
 */

/**
 * 字体定义，在scene的res中引用以预加载
 * LLFont.fonts[0]
 * */
LLFont = {
	fonts : [
		{
			type:"font",
			name:"FZCuYuan-M03",
			srcs:["res/fonts/FZCuYuan-M03.ttf"],
		}
	],
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	getFontNameWithFilepath : function (filepath) {
		let font = this.getFontWithFilepath(filepath);
		if (font) {
			if (cc.sys.isNative) {
				return font.srcs[0];
			} else {
				return font.name;
			}
		}
		return filepath;
	},

	getFontWithFilepath : function (filepath) {
		for (let font of this.fonts) {
			for (let src of font.srcs) {
				if (src.endsWith(filepath)) {
					return font;
				}
			}
		}
		return null;
	},
};
